/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package evotingclient.votesending;

import evotingclient.votesending.xmlsinger.XmlDSASigner;
import java.io.File;
import java.io.IOException;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
import org.w3c.dom.Document;
import org.xml.sax.SAXException;

/**
 *
 * @author Maciek
 */
public class ValidateFile {
    public static void main(String[] args) throws ParserConfigurationException, SAXException, IOException{
        String filename = "myvote.xml";
        DocumentBuilderFactory docBuilderFactory = DocumentBuilderFactory.newInstance();
        DocumentBuilder docBuilder2 = docBuilderFactory.newDocumentBuilder();
        Document vote = docBuilder2.parse(new File(filename));
        
        try{
           XmlDSASigner validator =new XmlDSASigner(); 
           validator.initXml();
           validator.validateSignature(vote);
        }catch (Exception e){
            System.err.println("Taki błąd : " + e.getMessage());
        }
    }
}
